package puyu.manage.service.print.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import puyu.manage.service.common.config.BaseController;
import puyu.manage.service.constant.AjaxResult;
import puyu.manage.service.print.service.SysPrintnumberService;

import javax.annotation.Resource;

import java.util.Map;

import static puyu.manage.service.constant.AjaxResult.success;

/**
 *  @ClassName: 打印记录
 *  @author: whl
 *  @Date: 2024/6/3 10:34
 *  @Description: Description of this class
 */
@Slf4j
@Api(tags = "打印记录")
@RestController
@RequestMapping("/sysPrintnumber")
public class SysPrintnumberController extends BaseController {

    /**
     * 服务对象
     */
    @Resource
    private SysPrintnumberService sysPrintnumberService;



    /**
     * 通过单据id查询次数
     *
     * @param expId 主键
     * @return 次数
     */
    @ApiOperation("通过主键查询单条数据")
    @GetMapping("{id}")
    public AjaxResult selectCountById(@PathVariable String expId) {
        return success(sysPrintnumberService.selectCountById(expId));
    }

    @ApiOperation("新增数据")
    @PostMapping
    public AjaxResult insertSysPrintnumber(@ApiParam(name="params",
            value="datas-数据",required=true) @RequestParam Map params) throws Exception{
        return success(sysPrintnumberService.insertSysPrintnumber(params));
    }

}

